#ifndef EVENTTRANSFER_H
#define EVENTTRANSFER_H

#include "../global.h"
#include <boost/thread/mutex.hpp>
#include <boost/thread/condition.hpp>
#include <deque>

class Event;

class EventTransfer : protected boost::noncopyable
{
public:
    typedef boost::shared_ptr< Event > EventPtr;
    typedef boost::mutex Mutex;
    typedef boost::condition Condition;
    typedef std::deque< EventPtr > EventQueue;

public:
    EventTransfer();
    ~EventTransfer();

    void postEvent(const EventPtr &ev);

    void peekEvent(EventPtr &ev);

    size_t eventCount();

protected:
    EventQueue m_eventQueue;

    Mutex m_lock;

    Condition m_condition;
};

#endif // EVENTTRANSFER_H
